﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace lazy
{
    public partial class lazy : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DropDownList1.Items.Add("福建");
                DropDownList1.Items.Add("贵州");
                DropDownList1.Items.Add("山东");
                DropDownList2.Items.Add("龙岩");
                DropDownList2.Items.Add("厦门");
                DropDownList2.Items.Add("泉州");
            }
        }

        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string province = DropDownList1.SelectedValue;
            DropDownList2.Items.Clear();

            if (province == "福建")
            {
                DropDownList2.Items.Add("龙岩");
                DropDownList2.Items.Add("厦门");
                DropDownList2.Items.Add("泉州");
            }
            else if (province == "贵州")
            {
                DropDownList2.Items.Add("贵阳");
                DropDownList2.Items.Add("遵义");
                DropDownList2.Items.Add("安顺");
            }
            else if (province == "山东")
            {
                DropDownList2.Items.Add("济南");
                DropDownList2.Items.Add("青岛");
                DropDownList2.Items.Add("菏泽");
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (FileUpload1.HasFile)
            {
                string fileName = FileUpload1.FileName;
                if (fileName.EndsWith(".jpg") || fileName.EndsWith(".png") || fileName.EndsWith(".jpeg"))
                {
                    string url = Server.MapPath("/img/" + fileName);
                    FileUpload1.SaveAs(url);
                    Image1.ImageUrl = "/img/" + fileName;
                    Image1.Visible = true;
                    Label3.Text = $"用户名：{TextBox1.Text},密码：{TextBox2.Text},性别：{RadioButtonList1.Text},省份：{DropDownList1.Text},市区：{DropDownList2.Text},其它信息：{TextBox4.Text}";
                }
                else
                {

                }
            }
            else
            {

            }
        }
    }
}